package com.cskaoyan.user.dto;

import com.cskaoyan.mall.commons.exception.ValidateException;
import com.cskaoyan.mall.commons.result.AbstractRequest;
import com.cskaoyan.user.constants.UserRetCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * 登录验证 请求头中存储的用户信息
 *
 * @author yemingfei
 * @since 2022/06/20 15:38
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserLoginVerifyRequest extends AbstractRequest {

    /**
     * uid : 77
     * file : https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif?imageView2/1/w/80/h/80
     * username : ymf123
     */
    private String uid;
    private String file;
    private String username;

    @Override
    public void requestCheck() {
        if(StringUtils.isBlank(uid) || StringUtils.isBlank(file) || StringUtils.isBlank(username)){
            throw new ValidateException(UserRetCode.REQUEST_CHECK_FAILURE.getCode(), UserRetCode.REQUEST_CHECK_FAILURE.getMessage());
        }
    }
}
